package ie.dcu.spca.view.user;

import java.util.List;
import java.util.Map;

import ie.dcu.spca.Main;
import ie.dcu.spca.data.BasicDataManager;
import ie.dcu.spca.data.UserDataManager;
import ie.dcu.spca.model.Bean;
import ie.dcu.spca.view.DataList;
import android.os.Bundle;

public class UserList extends DataList {

    private static UserDataManager userManager;

    protected void afterOnCreateInvoke(Bundle savedInstanceState) {
        super.afterOnCreateInvoke(savedInstanceState);
        userManager = Main.dataManager.userDataManager();
    }

    @Override
    protected BasicDataManager getBeanDataManager() {
        return userManager;
    }

    @Override
    protected Class getCRUDDialog() {
        return UserCRUDDialog.class;
    }

    @Override
    protected List<Bean> getDataListForRefreshOnWindowHasFocus() {
        return (List) userManager.get();
    }

    @Override
    protected void setBundleBeforeStartCRUDDialogForUpdate(Bundle bundle,
            Map<String, Object> dataMap) {
        bundle.putString(BasicDataManager.NAME, (String) dataMap
                .get(BasicDataManager.NAME));
    }
}
